//
//  FPCommodityDetailCell.m
//  ForestPack
//
//  Created by jimmy on 2018/7/10.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "FPCommodityDetailCell.h"
#import "Masonry.h"
#import "FPCustomButton.h"
#import "StarView.h"
#import "YZTagList.h"
#import "PaperBoxDetialModel.h"

@interface FPCommodityDetailCell()

@property (nonatomic,strong)  UILabel   * topOneLabel;
@property (nonatomic,strong)  UILabel   * topTwoLabel;
@property (nonatomic,strong)  UILabel   * topThreeLabel;
@property (nonatomic,strong)  UILabel   * topFourLabel;

@end

@implementation FPCommodityDetailCell

-(void)setCommodityDetailDataModel:(CommodityDetailDataModel *)commodityDetailDataModel
{
    _commodityDetailDataModel = commodityDetailDataModel;
    
//    self.topOneLabel.text = commodityDetailDataModel.;
//    self.topTwoLabel.text = commodityDetailDataModel.;
//    self.topThreeLabel.text = commodityDetailDataModel.;
//    self.topFourLabel.text = commodityDetailDataModel.;
    
}

+(FPCommodityDetailCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"FPCommodityDetailCell";
    FPCommodityDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[FPCommodityDetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    return cell;
}

- (void)createSubView
{
    self.topOneLabel = [[UILabel alloc] init];
    self.topOneLabel.text = @"2天";
    self.topOneLabel.textColor = FONTCOLOR_BLACK;
    self.topOneLabel.font = Kfont(12);
    self.topOneLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.topOneLabel];
    [self.topOneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(20);
        make.top.equalTo(self.mas_top).offset(8);
        make.width.equalTo(@((SCREEN_WIDTH - 70)/4));
        make.height.equalTo(@18);
    }];
    
    UILabel *bottomOneLabel = [[UILabel alloc] init];
    bottomOneLabel.text = @"平均完成时间";
    bottomOneLabel.textColor = RGB_COLOR(153,153,153);
    bottomOneLabel.font = Kfont(12);
    bottomOneLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:bottomOneLabel];
    [bottomOneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(20);
        make.top.equalTo(self.topOneLabel.mas_bottom);
        make.width.equalTo(@((SCREEN_WIDTH - 70)/4));
        make.height.equalTo(@18);
    }];
    
    self.topTwoLabel = [[UILabel alloc] init];
    self.topTwoLabel.text = @"1小时";
    self.topTwoLabel.textColor = FONTCOLOR_BLACK;
    self.topTwoLabel.font = Kfont(12);
    self.topTwoLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.topTwoLabel];
    [self.topTwoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.topOneLabel.mas_right).offset(10);
        make.top.equalTo(self.mas_top).offset(8);
        make.width.equalTo(@((SCREEN_WIDTH - 100)/4));
        make.height.equalTo(@18);
    }];
    
    UILabel *bottomTwoLabel = [[UILabel alloc] init];
    bottomTwoLabel.text = @"平均响应时间";
    bottomTwoLabel.textColor = RGB_COLOR(153,153,153);
    bottomTwoLabel.font = Kfont(12);
    bottomTwoLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:bottomTwoLabel];
    [bottomTwoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.topOneLabel.mas_right).offset(10);
        make.top.equalTo(self.topTwoLabel.mas_bottom);
        make.width.equalTo(@((SCREEN_WIDTH - 70)/4));
        make.height.equalTo(@18);
    }];
    
    self.topThreeLabel = [[UILabel alloc] init];
    self.topThreeLabel.text = @"1165";
    self.topThreeLabel.textColor = FONTCOLOR_BLACK;
    self.topThreeLabel.font = Kfont(12);
    self.topThreeLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.topThreeLabel];
    [self.topThreeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.topTwoLabel.mas_right).offset(10);
        make.top.equalTo(self.mas_top).offset(8);
        make.width.equalTo(@((SCREEN_WIDTH - 70)/4));
        make.height.equalTo(@18);
    }];
    
    UILabel *bottomThreeLabel = [[UILabel alloc] init];
    bottomThreeLabel.text = @"总计销量";
    bottomThreeLabel.textColor = RGB_COLOR(153,153,153);
    bottomThreeLabel.font = Kfont(12);
    bottomThreeLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:bottomThreeLabel];
    [bottomThreeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.topTwoLabel.mas_right).offset(10);
        make.top.equalTo(self.topThreeLabel.mas_bottom);
        make.width.equalTo(@((SCREEN_WIDTH - 70)/4));
        make.height.equalTo(@18);
    }];
    
    self.topFourLabel = [[UILabel alloc] init];
    self.topFourLabel.text = @"20";
    self.topFourLabel.textColor = FONTCOLOR_BLACK;
    self.topFourLabel.font = Kfont(12);
    self.topFourLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.topFourLabel];
    [self.topFourLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.topThreeLabel.mas_right).offset(10);
        make.top.equalTo(self.mas_top).offset(8);
        make.width.equalTo(@((SCREEN_WIDTH - 70)/4));
        make.height.equalTo(@18);
    }];
    
    UILabel *bottomFourLabel = [[UILabel alloc] init];
    bottomFourLabel.text = @"收藏量";
    bottomFourLabel.textColor = RGB_COLOR(153,153,153);
    bottomFourLabel.font = Kfont(12);
    bottomFourLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:bottomFourLabel];
    [bottomFourLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.topThreeLabel.mas_right).offset(10);
        make.top.equalTo(self.topFourLabel.mas_bottom);
        make.width.equalTo(@((SCREEN_WIDTH - 70)/4));
        make.height.equalTo(@18);
    }];
    
}

@end


@interface FPCommoditySecondCell()



@end

@implementation FPCommoditySecondCell


+(FPCommoditySecondCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"FPCommoditySecondCell";
    FPCommoditySecondCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[FPCommoditySecondCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    return cell;
}

-(void)advisoryClicked
{
    if (_advisoryClick) {
        _advisoryClick();
    }
}

-(void)enterShopClicked
{
    if (_enterShopClick) {
        _enterShopClick();
    }
}

-(void)createSubView
{
    FPRightLeftButton * leftButton = [FPRightLeftButton buttonWithType:UIButtonTypeCustom];
    [leftButton setTitle:@"在线咨询" forState:UIControlStateNormal];
    [leftButton setImage:[UIImage imageNamed:@"客服"] forState:UIControlStateNormal];
    [leftButton setTitleColor:RGB_COLOR(237,34,59) forState:UIControlStateNormal];
    leftButton.titleLabel.font = [UIFont systemFontOfSize:14];
    leftButton.titleLabel.textAlignment = NSTextAlignmentLeft;
    [leftButton addTarget:self action:@selector(advisoryClicked) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:leftButton];
    [leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.top.equalTo(self.mas_top);
        make.width.equalTo(@(SCREEN_WIDTH * 0.5));
        make.bottom.equalTo(self.mas_bottom);
    }];
    
    UILabel *lineLabel = [[UILabel alloc] init];
    lineLabel.backgroundColor = RGB_COLOR(220,220,220);
    [self addSubview:lineLabel];
    [lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(leftButton.mas_right);
        make.top.equalTo(self.mas_top);
        make.width.equalTo(@1);
        make.height.equalTo(self.mas_height);
    }];
    
    FPRightLeftButton * rightButton = [FPRightLeftButton buttonWithType:UIButtonTypeCustom];
    [rightButton setTitle:@"进入店铺" forState:UIControlStateNormal];
    [rightButton setImage:[UIImage imageNamed:@"进入店铺"] forState:UIControlStateNormal];
    [rightButton setTitleColor:FONTCOLOR_BLACK forState:UIControlStateNormal];
    rightButton.titleLabel.font = [UIFont systemFontOfSize:14];
    rightButton.titleLabel.textAlignment = NSTextAlignmentLeft;
    [rightButton addTarget:self action:@selector(enterShopClicked) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:rightButton];
    [rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(leftButton.mas_right).offset(1);
        make.top.equalTo(self.mas_top);
        make.width.equalTo(@(SCREEN_WIDTH * 0.5));
        make.bottom.equalTo(self.mas_bottom);
    }];
}


@end

@interface FPCommodityThirdCell()

@property (nonatomic,strong)  YYStarView * starView;
@property (nonatomic,strong)  UIImageView * leftImageV;
@property (nonatomic,strong)  UILabel *nameLabel;
@property (nonatomic,strong)  UILabel *timeLabel;
@property (nonatomic,strong)  UILabel *contentLabel;
@property (nonatomic,strong)  UILabel *moneyLabel;


@end

@implementation FPCommodityThirdCell

///这是评论的cell
+(FPCommodityThirdCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"FPCommodityThirdCell";
    FPCommodityThirdCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[FPCommodityThirdCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    return cell;
}

- (void)updateCommentShowDataModel:(CommentShowDataModel *)commentShowDataModel
{
    [self.leftImageV sd_setImageWithURL:[NSURL URLWithString:commentShowDataModel.person_img]];
    self.nameLabel.text = commentShowDataModel.realame;
    
    self.timeLabel.text = [FPLoginAndRegisterTools changeTime:commentShowDataModel.add_time];
    self.contentLabel.text = commentShowDataModel.content;
    self.starView.starScore = 2;
    self.moneyLabel.text = [NSString stringWithFormat:@"交易金额：%@元", commentShowDataModel.total_fee];
    
    
    //这里要请求到数据，评论是否有图片，有多张的话需要排序
    for (int i = 0; i < commentShowDataModel.pics.count; i ++) {
        self.contentImage = [[UIImageView alloc] init];
        //        self.contentImage.image = [UIImage imageNamed:@"头部背景图片"];
        [self.contentImage sd_setImageWithURL:[NSURL URLWithString:commentShowDataModel.pics[i]]];
        [self addSubview:self.contentImage];
        [self.contentImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@(67 + i * 80));
            make.top.equalTo(self.starView.mas_bottom).offset(5);
            make.width.equalTo(@70);
            make.height.equalTo(@70);
        }];
    }
}

- (void)updateRecordDetailDataModel:(CommentDetailDataModel *)commentDetailDataModel
{
 
    [self.leftImageV sd_setImageWithURL:[NSURL URLWithString:commentDetailDataModel.person_img]];
    self.nameLabel.text = commentDetailDataModel.realame;
    
    self.timeLabel.text = [FPLoginAndRegisterTools changeTime:commentDetailDataModel.add_time];
    self.contentLabel.text = commentDetailDataModel.content;
    self.starView.starScore = 2;
    self.moneyLabel.text = [NSString stringWithFormat:@"交易金额：%@元", commentDetailDataModel.total_fee];
    
    
    //这里要请求到数据，评论是否有图片，有多张的话需要排序
    for (int i = 0; i < commentDetailDataModel.pics.count; i ++) {
        self.contentImage = [[UIImageView alloc] init];
//        self.contentImage.image = [UIImage imageNamed:@"头部背景图片"];
        [self.contentImage sd_setImageWithURL:[NSURL URLWithString:commentDetailDataModel.pics[i]]];
        [self addSubview:self.contentImage];
        [self.contentImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@(67 + i * 80));
            make.top.equalTo(self.starView.mas_bottom).offset(5);
            make.width.equalTo(@70);
            make.height.equalTo(@70);
        }];
    }
}

- (void)createSubView
{
    self.leftImageV = [[UIImageView alloc] init];
    self.leftImageV.image = [UIImage imageNamed:@"进入店铺"];
    self.leftImageV.layer.masksToBounds = YES;
    self.leftImageV.layer.cornerRadius = 22;
    self.leftImageV.contentMode = UIViewContentModeScaleToFill;
    [self addSubview:self.leftImageV];
    [self.leftImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(13);
        make.top.equalTo(self.mas_top).offset(10);
        make.width.equalTo(@44);
        make.height.equalTo(@44);
    }];
    
    self.nameLabel = [[UILabel alloc] init];
    [self.nameLabel setText: @"路人甲"];
    self.nameLabel.textColor = FONTCOLOR_BLACK;
    self.nameLabel.font = Kfont(14);
    self.nameLabel.textAlignment = NSTextAlignmentLeft;
    [self addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImageV.mas_right).offset(10);
        make.top.equalTo(self.mas_top).offset(10);
        make.width.equalTo(@(SCREEN_WIDTH - 120));
        make.height.equalTo(@15);
    }];
    
   self.timeLabel = [[UILabel alloc] init];
    [self.timeLabel setText: @"一天前"];
    self.timeLabel.textColor = RGB_COLOR(153,153,153);
    self.timeLabel.font = Kfont(10);
    self.timeLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:self.timeLabel];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-10);
        make.top.equalTo(self.mas_top).offset(15);
        make.left.equalTo(self.nameLabel.mas_right).offset(5);
        make.height.equalTo(@15);
    }];
    
    self.contentLabel = [[UILabel alloc] init];
    [self.contentLabel setText: @"雇主未作出评价，系统默认好评"];
    self.contentLabel.textColor = RGB_COLOR(153,153,153);
    self.contentLabel.font = Kfont(14);
    self.contentLabel.textAlignment = NSTextAlignmentLeft;
    [self addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImageV.mas_right).offset(10);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(5);
        make.width.equalTo(@(SCREEN_WIDTH - 100));
        make.height.equalTo(@15);
    }];
    
    UILabel *praiseLabel = [[UILabel alloc] init];
    [praiseLabel setText: @"好评"];
    praiseLabel.textColor = RGB_COLOR(237,34,59);
    praiseLabel.font = Kfont(12);
    praiseLabel.textAlignment = NSTextAlignmentLeft;
    [self addSubview:praiseLabel];
    [praiseLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImageV.mas_right).offset(10);
        make.top.equalTo(self.contentLabel.mas_bottom).offset(5);
        make.width.equalTo(@28);
        make.height.equalTo(@15);
    }];
    
//     = [StarView starViewInitWithStarScore:5];
    
    self.starView = [YYStarView new];
    //StarView的类型，如果不设置，默认为Select类型
    self.starView.type = StarViewTypeShow;
    //星级评分，如果不设置，默认为0分（一般只有在展示时会设置这个属性）
    self.starView.starScore = 0;
    //星与星之间的间距，如果不设置，则默认为0
    self.starView.starSpacing = 10;
    //每颗星的大小，如果不设置，则按照图片大小自适应
    self.starView.starSize = CGSizeMake(12, 12);
    //亮色星图片名称，如果不设置，则使用默认图片
    self.starView.starBrightImageName = @"评价";
    //暗色星图片名称，如果不设置，则使用默认图片
    //如果你需要设置亮星与暗星的高亮图片，也是支持的你只需要将高亮图片名改为正常图片加后缀"_highlighted"即可
    self.starView.starDarkImageName = @"评价灰色";
    [self addSubview:self.starView];
    
    [self.starView mas_makeConstraints:^(MASConstraintMaker *make) {
        //只需设置位置即可，当然，如果你就想设置size也可以，或者不用masonry直接设置frame也可以，需要自己根据图片大小，间距算好size，不然图片会变形
        make.left.equalTo(praiseLabel.mas_right).offset(5);
        make.top.equalTo(self.contentLabel.mas_bottom).offset(5);
        make.width.equalTo(@70);
        make.height.equalTo(@20);
    }];
    
    self.moneyLabel = [[UILabel alloc] init];
    [self.moneyLabel setText: @"交易金额：1900元"];
   self.moneyLabel.textColor = FONTCOLOR_BLACK;
    self.moneyLabel.font = Kfont(12);
    self.moneyLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:self.moneyLabel];
    [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-10);
        make.top.equalTo(self.contentLabel.mas_bottom).offset(5);
        make.left.equalTo(self.starView.mas_right).offset(10);
        make.height.equalTo(@15);
    }];
    
    //这里要请求到数据，评论是否有图片，有多张的话需要排序
//    for (int i = 0; i < 3; i ++) {
//        self.contentImage = [[UIImageView alloc] init];
//        self.contentImage.image = [UIImage imageNamed:@"头部背景图片"];
//        [self addSubview:self.contentImage];
//        [self.contentImage mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.equalTo(@(67 + i * 80));
//            make.top.equalTo(praiseLabel.mas_bottom).offset(5);
//            make.width.equalTo(@70);
//            make.height.equalTo(@70);
//        }];
//    }
    
//    UILabel *lineLabel = [[UILabel alloc] init];
//    lineLabel.backgroundColor = RGB_COLOR(220,220,220);
//    [self addSubview:lineLabel];
//    [lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.mas_right);
//        make.bottom.equalTo(self.mas_bottom);
//        make.width.equalTo(self.mas_width);
//        make.height.equalTo(@1);
//    }];
    
    

}


@end

@interface FPCommodityFourCell ()<UIWebViewDelegate>

@property (nonatomic,strong)  UIWebView * webView;

@end

@implementation FPCommodityFourCell

+(FPCommodityFourCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"FPCommodityFourCell";
    FPCommodityFourCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[FPCommodityFourCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    return cell;
}

-(void)setCaseDetailModel:(CaseDetailModel *)caseDetailModel
{
    _caseDetailModel = caseDetailModel;
    
    NSString *strUrl1 = [self.caseDetailModel.data.content stringByReplacingOccurrencesOfString:@"&lt;" withString:@"<"];
    NSString *strUrl2 = [strUrl1 stringByReplacingOccurrencesOfString:@"&gt;" withString:@">"];
    NSString *strUrl3 = [strUrl2 stringByReplacingOccurrencesOfString:@"&quot;" withString:@"\""];
    NSString *htmls = [NSString stringWithFormat:@"<html> \n"
                       "<head> \n"
                       "<style type=\"text/css\"> \n"
                       "body {font-size:%dpx;}\n"// 字体大小，px是像素
                       "</style> \n"
                       "</head> \n"
                       "<body>"
                       "<script type='text/javascript'>"
                       "window.onload = function(){\n"
                       "var $img = document.getElementsByTagName('img');\n"
                       "for(var p in  $img){\n"
                       "$img[p].style.width = '100%%';\n"// 图片宽度
                       "$img[p].style.height ='auto'\n"// 高度自适应
                       "}\n"
                       "}"
                       "</script>%@"
                       "</body>"
                       "</html>",30, strUrl3];
//    self.webContent = [[NSString alloc] init];
//    self.webContent = htmls;
    [self setWebViewContent:htmls];
    
}

-(void)setCommodityDetailModel:(CommodityDetailModel *)commodityDetailModel
{
    _commodityDetailModel = commodityDetailModel;
    
    NSString *strUrl1 = [self.commodityDetailModel.data.content stringByReplacingOccurrencesOfString:@"&lt;" withString:@"<"];
    NSString *strUrl2 = [strUrl1 stringByReplacingOccurrencesOfString:@"&gt;" withString:@">"];
    NSString *strUrl3 = [strUrl2 stringByReplacingOccurrencesOfString:@"&quot;" withString:@"\""];
    NSString *htmls = [NSString stringWithFormat:@"<html> \n"
                       "<head> \n"
                       "<style type=\"text/css\"> \n"
                       "body {font-size:%dpx;}\n"// 字体大小，px是像素
                       "</style> \n"
                       "</head> \n"
                       "<body>"
                       "<script type='text/javascript'>"
                       "window.onload = function(){\n"
                       "var $img = document.getElementsByTagName('img');\n"
                       "for(var p in  $img){\n"
                       "$img[p].style.width = '100%%';\n"// 图片宽度
                       "$img[p].style.height ='auto'\n"// 高度自适应
                       "}\n"
                       "}"
                       "</script>%@"
                       "</body>"
                       "</html>",30, strUrl3];
    //    self.webContent = [[NSString alloc] init];
//        self.webContent = htmls;
    [self setWebViewContent:htmls];
    
}

- (void)createSubView
{
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScreenX375(200))];
    _webView.backgroundColor = [UIColor whiteColor];
    _webView.scalesPageToFit = YES;
    for (id subview in self.webView.subviews){
        if ([[subview class] isSubclassOfClass: [UIScrollView class]]){
            ((UIScrollView *)subview).bounces = NO;
            ((UIScrollView *)subview).scrollEnabled = NO;
        }
    }
    _webView.scrollView.showsVerticalScrollIndicator = NO;
    _webView.scrollView.showsHorizontalScrollIndicator = NO;
    _webView.delegate = self;
    [self addSubview:_webView];
}

-(void)setWebViewContent:(NSString *)urlString{
    [_webView loadHTMLString:urlString baseURL:nil];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView{
    if (_returnHeight){
//        CGFloat height = [[webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight"] floatValue];
        _webView.frame = CGRectMake(0, 0, SCREEN_WIDTH, webView.scrollView.contentSize.height);
        _returnHeight(webView.scrollView.contentSize.height);
    }
}

//-(void)setImg
//{
////   [self.imageV sd_setImageWithURL:_img placeholderImage:nil options:SDWebImageRetryFailed];
//}

@end

@interface FPTagListCell()
///标签的cell
@property (nonatomic,strong)  YZTagList  * tagList;

@end

@implementation FPTagListCell

+(FPTagListCell *)cellWithTableView:(UITableView *)tableView andIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"FPTagListCell";
    FPTagListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[FPTagListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor = [UIColor whiteColor];
        [cell createSubView];
    }
    return cell;
}

-(void)setEmployerCommentModel:(EmployerCommentModel *)employerCommentModel
{
    _employerCommentModel = employerCommentModel;
    
    NSArray *nameArray = employerCommentModel.labels;
    [self.tagList addTags:nameArray];
    
}

- (void)createSubView
{
    self.tagList = [[YZTagList alloc] init];
    [self addSubview:self.tagList];
//    NSArray *nameArr = @[@"好评",@"严谨认真",@"不错",@"提供优质方案",@"好评",@"不错",@"严谨认真",@"提供优质方案",@"严谨认真",@"提供优质方案"];
    [self.tagList mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.top.equalTo(self.mas_top);
        make.width.equalTo(self.mas_width);
        make.height.equalTo(self.mas_height);
    }];
    // 点击标签，就会调用,点击标签，删除标签
    self.tagList.clickTagBlock = ^(NSString *tag){
        
    };
    // 设置标签背景色
    self.tagList.tagBackgroundColor = [UIColor whiteColor];
    //设置标签颜色
    self.tagList.tagColor = RGB_COLOR(237,34,59);
    self.tagList.tagMargin = 8;
    self.tagList.tagFont = Kfont(10);
    self.tagList.borderWidth = 0.5;
    self.tagList.borderColor = RGB_COLOR(237,34,59);
    self.tagList.tagCornerRadius = 11;
    self.tagList.tagListH = 15;
    self.tagList.tagListCols = 2;
    
//    [self.tagList addTags:nameArr];
}

@end
